import 'package:flutter/material.dart';

class GridExtentCast extends StatelessWidget {
  const GridExtentCast({Key? key}) : super(key: key);
  List<Widget> getChildren() {
    return [1, 2, 3, 4, 5, 6, 7, 9, 10].map((int value) {
      return Container(
        alignment: Alignment.center,
        color: Colors.teal,
        child: Text(
          '第$value个',
          style: const TextStyle(color: Colors.white, fontSize: 30),
        ),
      );
    }).toList();
  }

  @override
  Widget build(BuildContext context) {
    return GridView.extent(
      maxCrossAxisExtent: 100.0, // 设置宽度
      crossAxisSpacing: 10,
      mainAxisSpacing: 10,
      childAspectRatio: 1,
      children: getChildren(),
    );
  }
}
